package ru.jarda.model.entities;

/**
 * Created by user on 14.02.2015.
 */
public class Category implements Comparable <Category>{
    private long id;
    private String name;
    private long  parentId;
    private int order;


    public Category(long id, String name, long parentId,int order) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.order = order;

    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Category category = (Category) o;

        if (id != category.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getParentId() {
        return parentId;
    }

    public void setParentId(long parentId) {
        this.parentId = parentId;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }


    @Override
    public int compareTo(Category category){
        return this.getOrder()-category.getOrder();
    }

}
